package com.knowif.backend.service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;
import com.knowif.pojo.UserOrder;
import com.knowif.pojo.UserOrderExample;
import com.knowif.pojo.UserOrderStatus;
import com.knowif.service.UserOrder_service;

@Service
public class UserOrderService {
	
	@Autowired
	private UserOrder_service userOrder_service;
	
	/**
	 * @author: xingyao 
	 * @Description:  查找订单信息，包括查找已经删除的订单信息
	 * @param userOrderExample
	 * @return
	 */
	public List<UserOrder> selectUserOrder(UserOrderExample userOrderExample){
		if(userOrderExample == null){
			return null;
		}
		List<UserOrder> userOrders = userOrder_service.selectByExampleAndNotVirtual(userOrderExample);
		return userOrders;
	}
	
	
	/**
	 * @author: xingyao 
	 * @Description:  查找订单流水详情
	 * @param userOrderId
	 * @return
	 */
	public List<UserOrderStatus> selectOrderStatus(Integer userOrderId){
		if(userOrderId == null){
			return null;
		}
		UserOrderExample userOrderExample = new UserOrderExample();
		userOrderExample.createCriteria().andIdEqualTo(userOrderId);
		return userOrder_service.selectOrderStatus(userOrderExample);
	}

	/**
	 * 订单筛选
	 * @param params
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public PageInfo<UserOrder> screen(Map<String, Object> params, int pageNum, int pageSize) {
		// 如果学员手机号为搜索条件
		return userOrder_service.screen(params, pageNum, pageSize);
	}
}






